Re-include CloseUnclosedStaticMocks in Mockito1to4Migration#1019
Merged
Conversation
Contributor
Author
|
CI failure here is pre-existing on
The reason it's been green on The expected vs. actual diff: …plus removal of the Happy to file a separate issue for that test if useful — but it shouldn't block this PR. |
timtebeek
approved these changes
Jun 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What's changed?
Re-enables
CloseUnclosedStaticMocksinside theMockito1to4Migrationcomposite recipe.What's your motivation?
CloseUnclosedStaticMockswas added toMockito1to4Migrationin Recipe for closing unclosed static mocks #739 so users wouldn't need to seek it out separately, then commented out two days later in d1e6bbb after @timtebeek observed it injecting teardown in the wrong scope for@Nestedclasses — e.g.JMockitMockUpToMockitoTest.mockUpAtSetUpWithTearDownTest()(see the discussion on #739).CloseUnclosedStaticMocks: Handle Nested class, qualifiedclass name. #742 (merged two days after the comment-out) handled nested classes and qualified mocked-class names, fixing the underlying issue. The YAML line was never re-enabled — appears to have been an oversight rather than a remaining concern.
Verification
Locally green:
JMockitMockUpToMockitoTest(the canary @timtebeek originally pointed at)CloseUnclosedStaticMocksTestMockito1to3MigrationTest,Mockito1to4MigrationTest,Mockito1to5MigrationTestorg.openrewrite.java.testing.mockito.*andorg.openrewrite.java.testing.jmockit.*packagesrecipeCsvValidate(both completeness and content)Checklist
CloseUnclosedStaticMocksTestand the composite migration tests)